home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / libraries / curses210.lha / src / box.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-22  |  2.1 KB  |  77 lines

  1. /* -*-C-*-
  2.  *
  3.  *
  4.  * Filename : box.c
  5.  *
  6.  * Author   : Simon J Raybould.    (sie@fulcrum.bt.co.uk).
  7.  *
  8.  * Date     : Friday 23rd August 1991.
  9.  *
  10.  * Desc     : Draw a box around window.
  11.  *
  12.  *
  13.  * THIS CODE IS NOT PUBLIC DOMAIN
  14.  * ==============================
  15.  * 
  16.  * This code is copyright Simon J Raybould 1991, all rights are reserved.
  17.  * All code, ideas, data structures and algorithms remain the property of the
  18.  * author. Neither the whole nor sections of this code may be used as part
  19.  * of other code without the authors consent. If you wish to use some of this
  20.  * code then please email me at (sie@fulcrum.bt.co.uk).
  21.  *
  22.  * This source is not public domain, so you do not have any right to alter it
  23.  * or sell it for personal gain. The source is provided purely for reference
  24.  * purposes. You may re-compile the source with any compiler you choose.
  25.  * You must not distribute altered copies without the authors consent. My
  26.  * intention is that the source will help people isolate any bugs much more
  27.  * effectivly.
  28.  *
  29.  * Disclaimer
  30.  * ==========
  31.  *
  32.  * No implication is made as to this code being fit for any purpose at all.
  33.  * I (the author) shall not be held responsible for any loss of data or damage 
  34.  * to property that may result from its use or misuse.
  35.  *
  36.  *
  37.  * Revision History
  38.  * ================
  39.  *
  40.  * $Log: box.c,v $
  41.  * Revision 1.1  1991/09/07  11:40:10  sie
  42.  * Initial revision
  43.  *
  44.  *
  45.  */
  46.  
  47. static char *rcsid = "$Header: /SRC/lib/curses/src/RCS/box.c,v 1.1 1991/09/07 11:40:10 sie Exp $";
  48.  
  49. #include "acurses.h"
  50.  
  51.  
  52. box(WINDOW *WinPtr, char vert, char hor)
  53. {
  54.   int i;
  55.   short CurY, CurX;
  56.   
  57.   CurY = WinPtr->_cury;
  58.   CurX = WinPtr->_curx;
  59.   
  60.   if(vert < 32 || vert > 126)
  61.     vert = '|';
  62.   if(hor < 32 || hor > 126)
  63.     hor = '-';
  64.   
  65.   for(i=0; i<=WinPtr->_maxx; i++) {
  66.     mvwaddch(WinPtr, 0, i, hor);  /* Top horizontal */
  67.     mvwaddch(WinPtr, WinPtr->_maxy, i, hor);  /* Bottom horizontal */
  68.   }
  69.   for(i=1; i<WinPtr->_maxy; i++) {
  70.     mvwaddch(WinPtr, i, 0, vert);  /* Left vertical */
  71.     mvwaddch(WinPtr, i, WinPtr->_maxx, vert);  /* Right vertical */
  72.   }
  73.   WinPtr -> _cury = CurY;
  74.   WinPtr -> _curx = CurX;
  75.   return OK;
  76. }
  77.